import type {
  IndicatorInfo,
  IndicatorSubmitInfoParams,
  IndicatorSubmitInfoResult,
  IndicatorSubmitSubmitParams,
} from '@/types'

const controller = getAjaxBaseUrl(
  '/indicatorSubmit',
  '/energy',
)

/** 指标录入详情 */
export function info(params: IndicatorSubmitInfoParams) {
  return post<IndicatorSubmitInfoResult>(
    `${controller}/info`,
    params,
  )
}

/** 查询指标列表 */
export function listIndicator(pointId: number) {
  return get<IndicatorInfo[]>(`${controller}/listIndicator`, {
    pointId,
    isVirtually: 0,
  })
}

/** 查询时间类型 */
export function listTimeType(indicatorId: number) {
  return get(`${controller}/listTimeType/${indicatorId}`)
}

/** 指标录入 */
export function submit(params: IndicatorSubmitSubmitParams) {
  return post(`${controller}/submit`, params)
}
